<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?
 function SendSMS ($host, $port, $username, $password, $phoneNoRecip, $msgText) {
 
     $fp = fsockopen($host, $port, $errno, $errstr);
     if (!$fp) {
         echo "errno: $errno \n";
         echo "errstr: $errstr\n";
         return $result;
     }
 
     fwrite($fp, "GET /?Phone=" . rawurlencode($phoneNoRecip) . "&Text=" . rawurlencode($msgText) . " HTTP/1.0\n");
     if ($username != "") {
        $auth = $username . ":" . $password;
        echo "auth: $auth\n";
        $auth = base64_encode($auth);
        echo "auth: $auth\n";
        fwrite($fp, "Authorization: Basic " . $auth . "\n");
     }
     fwrite($fp, "\n");
 
     $res = "";
 
     while(!feof($fp)) {
         $res .= fread($fp,1);
     }
     fclose($fp);
 
 
     return $res;
 }
 
 $x   = SendSMS("127.0.0.1", 80, "username", "password", "01676313700", "Test Message");
 echo $x;
 
 ?>
</body>
</html>
